package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws IOException {
        Scanner sc=new Scanner(System.in);
        FileOutputStream fos=new FileOutputStream("note.txt");
        while(true){
            System.out.println("请输入字符串");
            String name=sc.nextLine();
            if (!name.equals("exit")){
                fos.write(name.getBytes(StandardCharsets.UTF_8));
            }else{
                System.out.println("退出");
                break;
            }
        }
        System.out.println("结束");
        fos.close();

    }
}
